package com.beidouapp.dao.impl;

import java.util.List;
import java.util.Map;

import com.beidouapp.domain.pojo.RoleAndResource;
import com.beidouapp.mapper.BaseMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.beidouapp.mapper.ResourceMapper; 
import com.beidouapp.domain.pojo.Resource;
import com.beidouapp.dao.ResourceDao;

@Repository
public class ResourceDaoImpl extends BaseDaoImpl<Resource> implements
		ResourceDao {
	@Autowired
	private ResourceMapper resourceMapper;

	public BaseMapper<Resource> getResourceMapper() {
		return this.resourceMapper;
	}

	public List<Resource> findResourcesByResource(Resource resource) {
		return resourceMapper.findResourcesByResource(resource);
	}

	public List<Resource> findRoleResourcesByRoleId(Long roleId) {
		return resourceMapper.findRoleResourcesByRoleId(roleId);
	}

	public int removeRoleAndResourceByRoleId(Long roleId) {
		return resourceMapper.removeRoleAndResourceByRoleId(roleId);
	}

	public int addRoleAndResourceBatch(List<RoleAndResource> list) {
		return resourceMapper.addRoleAndResourceBatch(list);
	}

	public int removeRoleAndResourceBatch(Map<String, Object> params) {
		return resourceMapper.removeRoleAndResourceBatch(params);
	}

	@Override
	public List<Resource> findRoleResourcesByContactsLoginName(String LoginName) {
		return resourceMapper.findRoleResourcesByContactsLoginName(LoginName);
	}

	// ------------------------------

}
